package com.qlzb.taskmanagement.controller.cron;

import com.qlzb.taskmanagement.pojo.OutputWrapper;
import com.qlzb.taskmanagement.service.cron.CronInfoService;
import com.qlzb.taskmanagement.vo.form.CronInfoFormVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping("/cron/cronTask")
public class cronInfoController {

    @Autowired
    private CronInfoService cronInfoService;

    @ResponseBody
    @RequestMapping(value = "/addCronOne",method={RequestMethod.POST})
    public OutputWrapper addTimingOne(CronInfoFormVo vo) {
        OutputWrapper outputWrapper;
        outputWrapper = cronInfoService.add(vo);
        return outputWrapper;
    }

    @ResponseBody
    @RequestMapping(value = "/findCronById",method={RequestMethod.GET})
    public OutputWrapper findTimingById(@RequestParam("id") String id) {
        OutputWrapper outputWrapper = cronInfoService.findById(id);
        return outputWrapper;
    }

    @ResponseBody
    @RequestMapping(value = "/editCronOne",method={RequestMethod.POST})
    public OutputWrapper editTimingOne(@RequestBody CronInfoFormVo vo) {
        OutputWrapper outputWrapper = cronInfoService.modify(vo);
        return outputWrapper;
    }

    @ResponseBody
    @RequestMapping(value = "/listCronData",method={RequestMethod.POST})
    public OutputWrapper listTimingData(@RequestParam("id") String id) {
        return cronInfoService.removeById(id);
    }

}
